package io低级流or节点流;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**读取文本数据*/
public class ReadStringDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("./DA78.txt");
        FileInputStream fil = new FileInputStream(file);
        byte[] bytes = new byte[(int)file.length()];//创建与文件等长的字节数组
        fil.read(bytes);//读取字节数组
//        System.out.println(new String(bytes, StandardCharsets.UTF_8));
        String s = new String(bytes, StandardCharsets.UTF_8);//将字节数组转陈UTF-8的编码

        System.out.println(s);
        fil.close();


    }
}
